<?php


  require('includes/application_top.php');

  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_SPECIALS);

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_SPECIALS));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-22140239-1']);
  _gaq.push(['_setDomainName', '.ushop.vn']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
      <!--
<tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
-->
<style type="text/css">
#easyTooltip{
	margin:0 10px 1em 0;
	width:450px;
	padding:8px;
	background:#fcfcfc;
	border:1px solid #e1e1e1;
	line-height:130%;	
    text-align: left;			
	}
#easyTooltip h3{
	margin:0 0 .5em 0;
	font:13px Arial, Helvetica, sans-serif;
	text-transform:uppercase;
	}	
#easyTooltip p{
	margin:0 0 .5em 0;
	}		
#easyTooltip img{
		background:#fff;
		padding:1px;
		border:1px solid #e1e1e1;
		float:left;
		margin-right:10px;
		}		

</style>
<div class="home-specbar">
                    <div class="lblTitle">Sản phẩm khuyến mãi</div>
                    <!--<div class="lblViewall"><a href="products_specials.php" title="Xem thêm">Xem thêm</a></div>-->
                </div><br /><br /><br />
<?php
  $products_specials_array = array();

  $products_specials_query_raw = "select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC";
  $products_specials_split = new splitPageResults($products_specials_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

  if (($products_specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="smallText"><?php echo $products_specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
            <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  }
?>
      <tr>
        <td>
<?php
  if ($products_specials_split->number_of_rows > 0) {
    $products_specials_query = tep_db_query($products_specials_split->sql_query);
    
    $l=0;
    while ($products_specials = tep_db_fetch_array($products_specials_query)) {
        $l++;
      if ($new_price = tep_get_products_special_price($products_specials['products_id'])) {
        $products_price = '<s>' . $currencies->display_price($products_specials['products_price'], tep_get_tax_rate($products_specials['products_tax_class_id'])) . '</s><br /><span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_specials['products_tax_class_id'])) . '</span>';
      } else {
        $products_price = $currencies->display_price($products_specials['products_price'], tep_get_tax_rate($products_specials['products_tax_class_id']));
      }
?>
<script type="text/javascript">
    	$(document).ready(function(){	
    		$('#thum<?php echo $products_specials['products_id'] ?>').easyTooltip({
    		  <?php if($l%3==0){ ?>
                xOffset: -400,	
                <?php }else{ ?>
                xOffset: -20,
                <?php } ?>
    			useElement: 'product<?php echo $products_specials['products_id'] ?>'				   
    		});
    	});
//showtooltip('#thum<?php echo $specials_products['products_id'] ?>','#product<?php echo $specials_products['products_id'] ?>');
</script>
          <div class="product" id="thum<?php echo $products_specials['products_id'] ?>">
                <div class="product-thumb">
                    <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_specials['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_specials['products_image'], $products_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?>
                </div>
                <div align="center">
                    <a href="<?php echo tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_specials['products_id']) ?>"><img src="includes/languages/english/images/buttons/btnbag.jpg" /></a>
                </div>
                <div class="product-tit">
                    <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_specials['products_id']) . '">' . $products_specials['products_name'] . '</a>';?>
                </div>
                <div class="product-price">
                    <?php echo $products_price; ?> 
                </div>                
            </div>
             <div style="display: none;" id="product<?php echo $products_specials['products_id'] ?>">
        <h3><?php echo $products_specials['products_name'] ?></h3>
	<?php echo tep_image(DIR_WS_IMAGES . $products_specials['products_image'], $products_specials['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) ?>
	<p><?php echo nl2br($products_specials['products_description']) ?></p>

    </div>
<?php
    }
  } else {
?>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
          </tr>
        </table>
<?php
  }
?>
        </td>
      </tr>
<?php
  if (($products_specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
      </table>
      <div class="pagecount">
        <div class="pagenum"><?php echo $products_specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></div>
        <ul class="pagelist">
            <?php //TEXT_RESULT_PAGE . ' ' .  ?>
            <?php echo $products_specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?>
        </ul>
    </div>
<?php
  }
?>
    </table></td>
<!-- body_text_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
    </table></td>
  </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
